package com.dragon.refect.bytecode;

import java.lang.reflect.Proxy;

/**
 * @author dragon
 * @since 2019/12/9
 */
public class Client {

    public static void main(String[] args) {
        RealSubject realSubject = new RealSubject();
        DynamicSubject dynamicSubject = new DynamicSubject(realSubject);
        Class<? extends RealSubject> aClass = realSubject.getClass();

        Subject proxy = (Subject)Proxy.newProxyInstance(aClass.getClassLoader(), aClass.getInterfaces(), dynamicSubject);

        proxy.request();

        System.out.println(proxy.getClass());

        System.out.println(proxy.getClass().getSuperclass());

    }
}
